import React, { Component } from 'react';
import "./tooltip.css"
import PropTypes from 'prop-types'


class Tooltip extends Component {
    constructor(props) {
        super(props);
    }

    static propTypes = {
        tooltiptext: PropTypes.string,
        poi_x: PropTypes.number,
        poi_y: PropTypes.number,
    }

    render() {

        let { poi_x, poi_y, tooltiptext } = this.props;
        return (
            <svg className='tooltip'>


                {React.Children.only(this.props.children)}
                {tooltiptext ? <text fill="black" fontSize="9" id='onlywan' className='tooltiptext' key={'tooltip' + poi_x + poi_y} x={poi_x} y={poi_y}>{tooltiptext}</text> : null}

            </svg>
        );
    }
}

export default Tooltip;